home *** CD-ROM | disk | FTP | other *** search
- property pState, pFloatTime, pVelocityH, pVelocityV, pMySprite, pMyListPosition, pLifeTime, pMySize, p1stCastNum, pLastCastNum, pDirection
- global gTrackingList, cBound, cQMOffset, gReleaseTime
-
- on new me, listPosition
- set pMyListPosition to listPosition
- set pMySprite to pMyListPosition + cQMOffset
- set pState to 0
- set pVelocityH to random(7)
- set pVelocityV to random(7)
- return me
- end
-
- on liberateQM me
- setAt(gTrackingList, pMyListPosition, 1)
- set startH to randomInRange(getAt(cBound, 1), getAt(cBound, 3))
- set startV to randomInRange(getAt(cBound, 2), getAt(cBound, 4))
- set the loc of sprite pMySprite to point(startH, startV)
- set gReleaseTime to the ticks
- set pState to 1
- set randNum to random(2) - 1
- if randNum then
- set p1stCastNum to 25
- set pLastCastNum to 51
- set pDirection to -1
- else
- set p1stCastNum to 51
- set pLastCastNum to 25
- set pDirection to 1
- end if
- set pFloatTime to the ticks
- set pLifeTime to randomInRange(1800, 3600)
- end
-
- on QMAction me
- if pState then
- set currentPositionH to the locH of sprite pMySprite + pVelocityH
- set currentPositionV to the locV of sprite pMySprite + pVelocityV
- if currentPositionH < getAt(cBound, 1) then
- set pVelocityH to -1 * pVelocityH
- set currentPositionH to getAt(cBound, 1)
- end if
- if currentPositionV < getAt(cBound, 2) then
- set pVelocityV to -1 * pVelocityV
- set currentPositionV to getAt(cBound, 2)
- end if
- if currentPositionH > getAt(cBound, 3) then
- set pVelocityH to -1 * pVelocityH
- set currentPositionH to getAt(cBound, 3)
- end if
- if currentPositionV > getAt(cBound, 4) then
- set pVelocityV to -1 * pVelocityV
- set currentPositionV to getAt(cBound, 4)
- end if
- if the castNum of sprite pMySprite = p1stCastNum then
- set the castNum of sprite pMySprite to pLastCastNum
- else
- set the castNum of sprite pMySprite to the castNum of sprite pMySprite + pDirection
- end if
- set the loc of sprite pMySprite to point(currentPositionH, currentPositionV)
- checkFloatTime()
- end if
- updateStage()
- end
-
- on checkFloatTime me
- set howLong to the ticks - pFloatTime
- if howLong > pLifeTime then
- set pState to 0
- setAt(gTrackingList, pMyListPosition, 0)
- set the loc of sprite pMySprite to point(-1000, -1000)
- end if
- end
-
- on changVelocities me, whichOne
- if whichOne then
- set tempList to [1, -1]
- set pVelocityH to random(7) * getAt(tempList, random(2))
- set pVelocityV to random(7) * getAt(tempList, random(2))
- else
- set pVelocityH to 1
- set pVelocityV to 7
- set gAllTogetherNow to 1
- set the locV of sprite pMySprite to getAt(cBound, 4)
- end if
- end
-